
def b24(numbers = '012'):
    if len(numbers) == 1:
        yield numbers
    for i in range(len(numbers)):
        remain = list(numbers)
        del remain[i]
        for s in b24(''.join(remain)):
            yield numbers[i] + s

c = 0
for s in b24('0123456789'):
    c += 1
    if c == 1000000:
        print s
        break